<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="app">
        <textarea v-model="text" @input="much"></textarea>
        <p v-if="text.length <= total">剩余字数: {{ num }}/{{ total }}</p>
    </div>
</body>
<script src="./vue.js"></script>
<script>
    const { createApp, ref, computed } = Vue
    createApp({
        setup() {
            const text = ref('')
            const total = 10
            const num = computed(() => total - text.value.length)
            function much() {

            }
            return {
                text,
                total,
                num,
                much
            }

        }

    }).mount('#app')


</script>

</html>